package de.dlrg.wms.gui;

import java.util.Observable;
import java.util.Observer;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.GridLayout;

public class FormContainer implements Observer {

	private Shell shell;
	public Shell getShell() {
		return shell;
	}

	public Composite getComposite() {
		return composite;
	}

	private Composite composite;

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 * @wbp.parser.entryPoint
	 */
	public void createContents() {
		shell = new Shell();
		shell.setSize(450, 300);
		shell.setText("DLRG WMS 2011");
		shell.setLayout(new FillLayout(SWT.HORIZONTAL));

		composite = new Composite(shell, SWT.NONE);
		composite.setLayout(new GridLayout(1, false));

	}

	public void update() {
		shell.close();
	}
	
	public void update(Observable arg0, Object arg1) {
		shell.close();
	}
}
